package com.kun.alldb.support.metadata;

import com.kun.alldb.base.DatasourceBase;
import com.kun.alldb.support.MetaManager;
import com.kun.alldb.support.adaptor.DataSourceAdaptor;
import com.kun.db.meta.MetaUtil;
import com.kun.db.meta.TableType;
import lombok.extern.slf4j.Slf4j;

import javax.sql.DataSource;
import java.util.List;

/**
 * @author kun.li
 */
@Slf4j
public class DefaultMetaManager extends MetaManager {

    protected DataSource dataSource;

    public DefaultMetaManager(DatasourceBase datasourceBase) {
        super(datasourceBase);
        dataSource = DataSourceAdaptor.getDataSource(datasourceBase);
    }

    @Override
    public List<String> tableList(TableType... types) {
        return MetaUtil.getTables(dataSource, types);
    }




}
